var editor;
KindEditor.ready(function(K) {    		
    		var options = {
    			cssPath : '/css/index.css',
        		filterMode : false,
//        		uploadJson : '/zsnd/fileUpload.do',
                //fileManagerJson : '/zsnd/base/jsp/file_manager_json.jsp',
                allowFileManager : true
			};
			editor = K.create('textarea[name="contextEdit"]', options);
});

function preview() {
	editor.sync();
	html = $('#editor_id').val(); //获取文本框当前内容
	$.ajax({
        url: "preview.do",
        type: 'post',
        data: {contextReal : html},
        cache: false,
        success: function (text) {
        	if(text != null) {
        		var url = apachePath + text;
        		window.open (url, 'newwindow');
        	}
        }
    });
}

function getEditorContent(html) {
	var content = $("<html></html>");
	content.append(html);
	var contentHtml = content.find('.editor-wrapper').html();
	return contentHtml;
}